
package com.jml.cookie;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//添加Cookie
@WebServlet("/AddCookieServlet")
public class AddCookieServlet  extends HttpServlet {

	 @Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		   
		 Cookie cookie=new Cookie("jml", "yushengjun");
		 //为什么代码。。
		 resp.addCookie(cookie);
		 System.out.println("添加Cookie成功...");
	}
	
}
